{extend name="common/main"/}
{block name="style"}
<style>
    .module-show-list .module-list-box {
        cursor: pointer;
    }
</style>
{/block}
{block name="body"}
    <div class="main-title">
        <h2>{:lang("_MODULE_LISTS_")}</h2>
    </div>

    <div class="with-padding">
        <section class="module-list module-show-list cards clearfix">
            {volist name="modules" id="vo"}
                <div class="col-lg-3 col-md-4">
                    <div class="module-list-box" data-id="{$vo.id}" data-custom-admin="{$vo.custom_admin}" data-url="{$vo.admin_entry}" data-module="{$vo.name}">
                        <div class="card">
                            <div class="media-wrapper">
                                <div class="cover-icon">
                                    <img class="" src="{$vo.icon_photo}"/>
                                </div>
                            </div>
                            <div class="content-wrapper-module">
                                <div class="card-heading title">
                                    <h3>{$vo.alias} <span class="text-muted">{$vo.name}</span></h3>
                                </div>
                                <div class="card-content text-muted">
                                    <p class="text-muted text-ellipsis">
                                        {$vo.summary}
                                    </p>
                                    <p class="text-muted text-ellipsis">
                                        {:lang("_DEVELOPER_")}{:lang('_COLON_')} {$vo.developer}
                                    </p>
                                </div>

                                <div class="card-actions clearfix">
                                    <div class="pull-left">
                                        {empty name="vo.token"}
                                            <span class="btn btn-xs btn-warning">{:lang("_LOCAL_MODULE_")}</span>
                                        {else/}
                                            <a target="_blank"
                                               href="{:appstoreUrl('Appstore/Index/Info',array('token'=>$vo['token']))}"
                                               class="btn btn-xs btn-info">{:lang("_GO_TO_THE_CLOUD_MARKET_VIEW_")}</a>
                                        {/empty}
                                    </div>
                                    <div class="pull-right">
                                        {empty name="vo.token"}
                                            <span class="label label-info">{$vo.version}</span>
                                        {else/}
                                            <span class="label label-info">{$vo.version_info.title}</span>
                                        {/empty}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            {/volist}
        </section>
        <!--分页-->
        <div class="pager">{$page}</div>
    </div>

{/block}

{block name="script"}
<script>
$(function(){
    $('.module-list-box').click(function(){

        var _this = $(this);
        var url = Url(_this.data('url'));//跳转的URL
        var custom_admin = _this.data('custom-admin');//是否自定义后台
        var _module = _this.data('module');
        console.log(url);
        if(custom_admin == 0){

            //打开模块url
            window.location.href=url;
            //关闭其它菜单栏
            $(window.parent.document).find('.menu-open').removeClass('menu-open');
            $(window.parent.document).find('.treeview-menu').css('display','none');
            //treeview-menu
            //展开侧栏菜单栏
            var _li = $(window.parent.document).find('[data-module="' +_module+ '"]');
                _li.addClass('menu-open');
                _li.find('.treeview-menu').css('display','block');
            
        }else{
            window.open(url); 
        }
    });
});

</script>
{/block}